home *** CD-ROM | disk | FTP | other *** search
/ Merciful 5 / Merciful - Disc 5.iso / software / p / pcqpascalv1.2d.lha / Include / Devices / SCSIDisk.i < prev    next >
Text File  |  1997-05-06  |  5KB  |  112 lines

  1. {
  2.         SCSIDisk.i for PCQ Pascal
  3.  
  4.         SCSI exec-level device command
  5. }
  6.  
  7. {--------------------------------------------------------------------
  8.  *
  9.  *   SCSI Command
  10.  *      Several Amiga SCSI controller manufacturers are converging on
  11.  *      standard ways to talk to their controllers.  This include
  12.  *      file describes an exec-device command (e.g. for hddisk.device)
  13.  *      that can be used to issue SCSI commands
  14.  *
  15.  *   UNIT NUMBERS
  16.  *      Unit numbers to the OpenDevice call have encoded in them which
  17.  *      SCSI device is being referred to.  The three decimal digits of
  18.  *      the unit number refer to the SCSI Target ID (bus address) in
  19.  *      the 1's digit, the SCSI logical unit (LUN) in the 10's digit,
  20.  *      and the controller board in the 100's digit.
  21.  *
  22.  *      Examples:
  23.  *                0     drive at address 0
  24.  *               12     LUN 1 on multiple drive controller at address 2
  25.  *              104     second controller board, address 4
  26.  *               88     not valid: both logical units and addresses
  27.  *                      range from 0..7.
  28.  *
  29.  *   CAVEATS
  30.  *      Original 2090 code did not support this command.
  31.  *
  32.  *      Commodore 2090/2090A unit numbers are different.  The SCSI
  33.  *      logical unit is the 100's digit, and the SCSI Target ID
  34.  *      is a permuted 1's digit: Target ID 0..6 maps to unit 3..9
  35.  *      (7 is reserved for the controller).
  36.  *
  37.  *          Examples:
  38.  *                3     drive at address 0
  39.  *              109     drive at address 6, logical unit 1
  40.  *                1     not valid: this is not a SCSI unit.  Perhaps
  41.  *                      it's an ST506 unit.
  42.  *
  43.  *      Some controller boards generate a unique name (e.g. 2090A's
  44.  *      iddisk.device) for the second controller board, instead of
  45.  *      implementing the 100's digit.
  46.  *
  47.  *      There are optional restrictions on the alignment, bus
  48.  *      accessability, and size of the data for the data phase.
  49.  *      Be conservative to work with all manufacturer's controllers.
  50.  *
  51.  *------------------------------------------------------------------}
  52.  
  53. Const
  54.  
  55.     HD_SCSICMD          = 28;   { issue a SCSI command to the unit }
  56.                                 { io_Data points to a SCSICmd }
  57.                                 { io_Length is sizeof(struct SCSICmd) }
  58.                                 { io_Actual and io_Offset are not used }
  59.  
  60. Type
  61.  
  62.     SCSICmd = record
  63.         scsi_Data       : Address; { word aligned data for SCSI Data Phase }
  64.                                    { (optional) data need not be byte aligned }
  65.                                    { (optional) data need not be bus accessable }
  66.         scsi_Length     : Integer; { even length of Data area }
  67.                                    { (optional) data can have odd length }
  68.                                    { (optional) data length can be > 2**24 }
  69.         scsi_Actual     : Integer; { actual Data used }
  70.         scsi_Command    : Address; { SCSI Command (same options as scsi_Data) }
  71.         scsi_CmdLength  : Short;   { length of Command }
  72.         scsi_CmdActual  : Short;   { actual Command used }
  73.         scsi_Flags      : Byte;    { includes intended data direction }
  74.         scsi_Status     : Byte;    { SCSI status of command }
  75.         scsi_SenseData  : String;  { sense data: filled IF SCSIF_[OLD]AUTOSENSE }
  76.                                    { is set AND scsi_Status has CHECK CONDITION }
  77.                                    { (bit 1) set }
  78.         scsi_SenseLength : Short;  { size of scsi_SenseData, also bytes to }
  79.                                    { request w/ SCSIF_AUTOSENSE, must be 4..255 }
  80.         scsi_SenseActual : Short;  { amount actually fetched (0 means no sense) }
  81.     end;
  82.     SCSICmdPtr = ^SCSICmd;
  83.  
  84.  
  85. Const
  86.  
  87. {----- scsi_Flags -----}
  88.     SCSIF_WRITE         = 0;    { intended data direction is out }
  89.     SCSIF_READ          = 1;    { intended data direction is in }
  90.     SCSIB_READ_WRITE    = 0;    { (the bit to test) }
  91.  
  92.     SCSIF_NOSENSE       = 0;       { no automatic request sense }
  93.     SCSIF_AUTOSENSE     = 2;       { do standard extended request sense }
  94.                                          { on check condition }
  95.     SCSIF_OLDAUTOSENSE  = 6;       { do 4 byte non-extended request }
  96.                                         { sense on check condition }
  97.     SCSIB_AUTOSENSE     = 1;       { (the bit to test) }
  98.     SCSIB_OLDAUTOSENSE  = 2;       { (the bit to test) }
  99.  
  100.  
  101. {----- SCSI io_Error values -----}
  102.     HFERR_SelfUnit      = 40;   { cannot issue SCSI command to self }
  103.     HFERR_DMA           = 41;   { DMA error }
  104.     HFERR_Phase         = 42;   { illegal or unexpected SCSI phase }
  105.     HFERR_Parity        = 43;   { SCSI parity error }
  106.     HFERR_SelTimeout    = 44;   { Select timed out }
  107.     HFERR_BadStatus     = 45;   { status and/or sense error }
  108.  
  109. {----- OpenDevice io_Error values -----}
  110.     HFERR_NoBoard       = 50;   { Open failed for non-existant board }
  111.  
  112.